package com.zou.controller.proscenium;

import com.zou.controller.proscenium.common.InitCommon;
import com.zou.pojo.Info;
import com.zou.service.InfoService;
import com.zou.service.MaxMenuService;
import com.zou.service.MinMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

@Controller("prosceniumIndexController")
public class IndexController {
    @Autowired
    private InfoService infoService;
    @Autowired
    private MaxMenuService maxMenuService;
    @Autowired
    private MinMenuService minMenuService;

    @GetMapping({"/index", "/proscenium/index"})
    public String index(Model model) {
        model = new InitCommon(infoService, maxMenuService, minMenuService, model).initHtml();

        List<Info> infoList1 = infoService.queryInfoByMaxId(1);
        model.addAttribute("infoList1", infoList1);
        List<Info> infoList2 = infoService.queryInfoByMaxId(2);
        model.addAttribute("infoList2", infoList2);

        return "proscenium/index";
    }
}
